Storing Pictures

It frequently happens that a picture, or part of a picture, needs to replicated. In many instances it is only the labels which need to be changed. The general LATEX command for saving objects is

\savebox{<box name>}(<box width>,<box height>)[<position>]{<object>}
This saves the `object' in a `box' but does not draw it directly. To draw it the drawoldpic command may again be used as shown below. The box name must begin with a backslash (). The width and height will be in centipoints. The ``position'' argument is optional and may be ignored. If so the picture will be centred in the box. Other options are [tr] [br] [tl] [bl] which will position the picture in a corner of the named box, and [t] [b] [l] [r] which will place the picture along a side. The `object' in this case is a picture commencing with \begin{picture} and terminating with \end{picture}. Just as variable names must be initialized so must box names. Prior to the savebox a command \global\newsavebox<name> must appear and this name must not be used again. The saved picture takes the form:
\global\newsavebox{\Brehmsstrahlung}
      .
      .
      .
\savebox{\Brehmsstrahlung}(10000,14000)[tl]{
\begin{picture}(10000,140000)(2000,3000)
      .
      .
      .
\end{picture}
}  % end of \savebox
      .
      .
      .
\begin{picture}(18000,22000)
...(various Feynman commands)
\drawoldpic\Brehmsstrahlung(\pbackx,\pbacky)
\global\advance\pbackx by 2000
\drawoldpic\Brehmsstrahlung(\pbackx,\pbacky)
\global\advance\pbackx by 2000
\drawoldpic\Brehmsstrahlung(\pbackx,\pbacky)
...(various Feynman commands)
\end{picture}
with further possible uses in other diagrams. Of course the picture could be merely stored and directly used as an entire diagram. LATEX keeps the stored box around thereafter occupying valuable storage space. Thus when one is done with the stored picture the command
\sbox{\Brehmsstrahlung}{}
will clear the space. The box will continue to exist and new objects may be stored in it without a further newsavebox statement. One is cautioned that positioning the old picture within a new picture may require some experimentation since the box sizes may not match. The other caution is that TEX's resources tend to become exhausted with a bewildering rapidity which limits the size of stored pictures. The following is a simple example.
\global\newsavebox{\ESHOWER}
\savebox{\ESHOWER}(0,0)[tl]{
\begin{picture}(0,0)
\drawline\photon[\SE\REG](0,0)[8]
\drawline\fermion[\E\REG](\photonbackx,\photonbacky)[2000]
\drawline\fermion[\S\REG](\photonbackx,\photonbacky)[2000]
\end{picture}
}   % end savebox
\begin{picture}(15000,5000)
\drawline\fermion[\E\REG](0,5000)[15000]
\drawoldpic\ESHOWER(0,5000)
\drawoldpic\ESHOWER(5000,5000)
\drawoldpic\ESHOWER(10000,5000)
\end{picture}
\sbox{\ESHOWER}{}
producing (0,0)[tl]
\begin{picture}(0,0)
\drawline\photon[\SE\REG](0,0)[8]
\drawline\fermion[\E\REG]...
...)[2000]
\drawline\fermion[\S\REG](\photonbackx,\photonbacky)[2000]
\end{picture}

\begin{picture}(15000,5000)
\drawline\fermion[\E\REG](0,5000)[15000]
\drawoldpic...
...00)
\drawoldpic\ESHOWER(5000,5000)
\drawoldpic\ESHOWER(10000,5000)
\end{picture}

Note the sbox used to empty the box. Also note the trick of storing a box of zero dimension. This greatly simplifies the positioning of stored diagram. One might expect that the gluon branches (together with labelling) in the cover diagram were generated this way. Alas there was insufficient memory to store them (gluon vertices are particularly expensive) and they were drawn by duplicating the statements. This saved storage space at the expense of CPU. One may also store boxes within boxes. Thus the entire three-photon diagram above could have been stored and re-used. Indeed this is the basic technique used in constructing lines and vertices.